<template>
  <el-container>
    <el-header>疫情服务</el-header>
    <el-container>
      <el-aside width="200px" style="background-color: rgb(238, 241, 246)">
        <el-menu :default-openeds="['1','2']">
          <el-submenu index="1">
            <template slot="title"><i class="el-icon-message"></i>生活救助</template>
            <el-menu-item-group>
              <el-menu-item index="1-1">
                <router-link to="/epidemic_relief" tag="li">物资救助</router-link>
              </el-menu-item>
              <el-menu-item index="1-2">
                <router-link to="/epidemic_special_things" tag="li">特殊事物</router-link></el-menu-item>
            </el-menu-item-group>
            <el-menu-item index="1-3" v-if="username=='admin'">
                <router-link to="/epidemic_special_things_backstage" tag="li">特殊事物-后台</router-link></el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="2">
            <template slot="title"><i class="el-icon-message"></i>预约核酸</template>
            <el-menu-item-group>
              <el-menu-item index="2-1" @click="fill()">
                <router-link to="/health" tag="li">预约申请</router-link>
              </el-menu-item>
              <label>
                <el-menu-item id="test_type" index="2-2">
                  <router-link to="/epidemic_record" tag="li">我的记录</router-link>
                </el-menu-item>
              </label>
              <label>
                <el-menu-item id="test_type" index="2-3" v-if="username=='admin'">
                  <router-link to="/epidemic_reservationdata" tag="li">预约数据</router-link>
                </el-menu-item>
              </label>
            </el-menu-item-group>
          </el-submenu>
        </el-menu>
      </el-aside>
      <el-main>
        <router-view />
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
  export default {
    name: 'epidemicView',
    data() {
      return {
        //用户username

        isfill: true
      }
    },
    methods: {
      fill() {
        if (this.isfill == false) {
          let test_type = document.getElementById("test_type");
          test_type.className = "el-menu-item is-disabled";
        } else {
          let test_type = document.getElementById("test_type");
          test_type.className = "el-menu-item";
        }
      }
    },
    created() {
      this.username = JSON.parse(sessionStorage.getItem("user")).username
    }

  }
</script>

<style>
  .el-header,
  .el-footer {
    background-color: #B3C0D1;
    color: #333;
    text-align: center;
    line-height: 60px;
  }

  .el-aside {
    background-color: #D3DCE6;
    color: #333;
    text-align: center;
    line-height: 200px;
  }

  .el-main {
    background-color: #E9EEF3;
    color: #333;
    text-align: center;
    /* line-height: 160px; */
  }

  body>.el-container {
    margin-bottom: 40px;
  }

  .el-container:nth-child(5) .el-aside,
  .el-container:nth-child(6) .el-aside {
    line-height: 260px;
  }

  .el-container:nth-child(7) .el-aside {
    line-height: 320px;
  }
</style>
